<%--
  Created by IntelliJ IDEA.
  User: KaiFaBu010
  Date: 2018-01-05
  Time: 17:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <jsp:include page="/WEB-INF/jsp/head.jsp">
        <jsp:param value="${game.gname}交易录入" name="pageTitle"/>
    </jsp:include>
</head>
<body>
<c:set var="bankList" value="${bankList}"/>
<c:set var="bankByDealtVOList" value="${bankByDealtVOList}"/>
<div id="ttSellBusiness" class="easyui-tabs" data-options="fit:true">
    <div title="${game.gname}卖分录入" style="padding:2px">
        <div class="easyui-layout" data-options="fit:true" style="width: auto;height: auto;">
            <form id="sellBusiness" action="/#" method="post">
                <input name="userID" value="${userID}" type="hidden"/>
                <div data-options="region:'north'" style="height: auto;padding:4px 4px 6px 4px;">

                    <strong>操作人:</strong>${userRName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <strong>工作日:</strong>${nowDay}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <strong>班次:</strong>${shift}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <br/>
                    <input type="hidden" id="Gid" name="Gid" value="${game.gid}">
                    卖分比例：<input class="yj-text  " type="text" id="sellProportion" name="sellProportion" value="${game.sellProportion}"
                                data-options="min:0,precision:2" groupSeparator="," readonly="readonly" style="width: 100px;"/>&nbsp;&nbsp;&nbsp;
                    买分比例：<input class="yj-text  " type="text" id="buyProportion" name="buyProportion" value="${game.buyProportion}"
                                data-options="min:0,precision:2" groupSeparator="," readonly="readonly" style="width: 100px;"/>&nbsp;&nbsp;&nbsp;
                    进货比例:<input class="yj-text  " type="text" id="stockProportion" name="stockProportion" value="${game.stockProportion}"
                                data-options="min:0,precision:2" groupSeparator="," readonly="readonly" style="width: 100px;"/>
                    <button id="btnAcc" type="button" class="easyui-linkbutton"><i class="fa fa-save"></i>&nbsp;修改比例
                    </button>
                    <button id="btnAccSave" type="button" class="easyui-linkbutton"><i class="fa fa-save"></i>&nbsp;修改保存
                    </button>
                    <br/>
                    <button id="btnSave" type="submit" class="easyui-linkbutton"><i class="fa fa-save"></i>&nbsp;保存
                    </button>
                </div>
                <div data-options="region:'center',border:false">
                    <div class="easyui-panel" title="${game.gname}交易基本信息" data-options="iconCls:'icon-edit',fit:true"
                         style="padding:4px;">
                        <table class="yj-table2" cellpadding="0" cellspacing="0">
                            <tr>
                                <c:forEach items="${bankList}" var="each_bank">
                                    <td style="border-color: #ff4500">${each_bank.alias}</td>
                                </c:forEach>
                            </tr>
                            <tr>
                                <c:forEach items="${bankList}" var="each_bank">
                                    <td style="border-color: #ff4500">${each_bank.initialnum}</td>
                                </c:forEach>
                            </tr>
                            <tr>
                                <c:forEach items="${bankList}" var="each_bank">
                                    <td >
                                        <input class="yj-text easyui-numberbox " type="text" id=${each_bank.bid}+"sellingscore" name=${each_bank.bid}+"sellingscore"
                                               data-options="min:0,precision:2" groupSeparator="," style="width: 100px;"/>
                                    </td>
                                </c:forEach>

                            </tr>
                            <tr>
                                <td>此班您的交易历史：</td>
                            </tr>
                            <tr>
                                <c:forEach items="${bankByDealtVOList}" var="each_bankByDealt">
                                    <td >
                                    ${each_bankByDealt.income}|
                                    </td>
                                </c:forEach>
                            </tr>

                        </table>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div title="${game.gname}买分录入" style="padding:2px">
        <iframe id="buyBusiness" scrolling="auto" frameborder="0" src="/#?Gid=${game.gid}"
                width="100%" height="100%" style="padding:0;margin:0;"></iframe>
    </div>
    <div title="${game.gname}进货录入" style="padding:2px">
        <iframe id="stockBusiness" scrolling="auto" frameborder="0" src="/#?Gid=${game.gid}"
                width="100%" height="100%" style="padding:0;margin:0;"></iframe>
    </div>

</div>
<script>



    $("#btnAcc").click(function(){
        $("#sellProportion").removeAttr("readonly");
        $("#buyProportion").removeAttr("readonly");
        $("#stockProportion").removeAttr("readonly");
    });


    $('#btnAccSave').click(function () {
        var sellProportion= $("#sellProportion").val();
        var buyProportion=$("#buyProportion").val();
        var stockProportion=$("#stockProportion").val();
        var Gid=$('#Gid').val();
        $.ajax({
            type: "POST",
            url: "/gameAccount/insetNewGameAccount",
            data: {
                "Gid":Gid,
                "sellProportion": sellProportion,
                "buyProportion":buyProportion,
                "stockProportion":stockProportion
            },
            dataType: "json",
            success: function (data) {
                $.messager.alert('提示信息', data["msg"], 'warning', function () {
                    //跳转地址
                    location.href = "/dealTable/sellBusiness";
                });

            }
        });
    });


    // 验证提交
    $("#sellBusiness").validator({
        theme: "yellow_right",
        valid: function (form) {
            $(form).form('submit', {
                success: function (data) {
                       var newdata = $.parseJSON(data);
                    $.messager.alert('提示信息', newdata['msg'], 'info', function () {
                        //跳转地址
                        location.reload();
                    });
                    $('.panel-tool-close').hide();//隐藏关闭按钮
                }
            });
        }
    });
</script>
</body>
</html>
